#include <iostream>

using namespace std;

class Point
{
public:
    Point();
    Point(int x, int y);
    void print();

private:
    int _ix;
    int _iy;
};

void test()
{
    //only constructor and deconstructor and read only function can use
    const Point p;

    //point to object
    Point pt(1, 2);
    Point * p1 = nullptr;
    Point * p2 = &pt;
    Point * p3 = new Point(3, 4);

    //array of object
    Point pts[2] = {Point(1, 2), Point(3, 4)};
    Point pts1[] = {Point(1, 2), Point(3, 4)};
    Point pts2[5] = {Point(1, 2), Point(3, 4)};
    //or
    Point pts3[2] = {{1, 2}, {3, 4}};
    pts1->print();  //（1,2）
    (pts2 + 1)->print(); //(3,4)
    Point pts4[] = {{1, 2}, {3, 4}};
    Point pts5[5] = {{1, 2}, {3, 4}};

    //heap of object
    Point * pt1 = new Point(11, 12);
	pt1->print();
	delete pt1;
	pt1 = nullptr;

	Point * pt2 = new Point[5]();//notice
	pt2->print();
	(pt2 + 1)->print();
	delete [] pt2;
    pt2 = nullptr;
}

int main()
{
    test();
    return 0;
}

